//
//  SplitView.swift
//  SwiftUIFly
//
//  Created by shen on 2023/10/18.
//

import SwiftUI

struct SplitView: View {
    @Environment(\.userTint) private var userTint

    @State var selectedItem: DemoSection?

    var body: some View {
        NavigationView {
            list
            #if os(macOS)
            .listStyle(.sidebar)
            #else
            .navigationTitle("SwiftUI")
            #endif

            #if os(macOS)
            Text("Select a group")
            #endif
        }
        .tint(userTint)
    }

    var list: some View {
        List {
            Grouping(title: "Text", icon: "text.aligncenter", content: { ExampleTextView() })
            Grouping(title: "Buttons", icon: "capsule", content: { ExampleButtonView() })
            Grouping(title: "Colors", icon: "paintpalette", content: { ExampleColorsView() })
            Grouping(title: "Controls", icon: "slider.horizontal.3", content: { ExampleControlsView() })
            Grouping(title: "Fonts", icon: "textformat", content: { ExampleFontsView() })

            #if os(iOS)
            Group {
                Grouping(title: "Haptics", icon: "waveform", content: { ExampleHapticsView() })
                Grouping(title: "Gestures", icon: "hand.tap", content: { ExampleGesturesView() })
            }
            #endif

            Grouping(title: "Images", icon: "photo", content: { ExampleImagesView() })
            Grouping(title: "Indicators", icon: "speedometer", content: { ExampleIndicatorsView() })
            Grouping(title: "Shapes", icon: "square.on.circle", content: { ExampleShapesView() })
            Grouping(title: "Symbols", icon: "syringe", content: { ExampleSymbolView() })
        }
    }
}
